package com.mk.cloud.common.domain;

import com.mk.cloud.pt.dto.CpSsorolePlatformDTO;
import org.beetl.sql.core.annotatoin.AssignID;
import org.beetl.sql.core.annotatoin.Param;
import org.beetl.sql.core.annotatoin.TableTemplate;
import org.beetl.sql.core.mapper.BaseMapper;

import javax.persistence.Transient;
import java.io.Serializable;
import java.util.List;

/*
* 
* gen by beetlsql 2017-10-23
*/
@TableTemplate("order by rolepid,roleid")
public class CpSsorolePlatform implements Serializable {
    //角色ID
    @AssignID
    private String roleid;
    //备注
    private String remark;
    //角色编码
    private String rolecode;
    //角色名字
    private String rolename;
    //父角色ID
    private String rolepid;
    //父角色名称
    @Transient
    private String rolepname;
    //是否有效 1=有效 0=无效(默认有效)
    private String rolestate;

    public CpSsorolePlatform() {
    }

    public String getRolepname() {
        return rolepname;
    }

    public void setRolepname(String rolepname) {
        this.rolepname = rolepname;
    }

    public String getRoleid() {
        return roleid;
    }

    public void setRoleid(String roleid) {
        this.roleid = roleid;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getRolecode() {
        return rolecode;
    }

    public void setRolecode(String rolecode) {
        this.rolecode = rolecode;
    }

    public String getRolename() {
        return rolename;
    }

    public void setRolename(String rolename) {
        this.rolename = rolename;
    }

    public String getRolepid() {
        return rolepid;
    }

    public void setRolepid(String rolepid) {
        this.rolepid = rolepid;
    }

    public String getRolestate() {
        return rolestate;
    }

    public void setRolestate(String rolestate) {
        this.rolestate = rolestate;
    }

    public interface Mapper extends BaseMapper<CpSsorolePlatform> {
        /**
         * 平台
         * 根据角色id删除对应的角色
         * @param roleid
         * @return
         */
        int deleteRolePlatform(@Param("roleid") String roleid);

        /**
         * 平台
         * 保存平台角色层级结构
         * @param roles
         * @return
         */
        int saveRoleStructurePlatform( @Param("roles") List<CpSsorolePlatform> roles);

        /**
         * 保存平台角色分配的资源
         * @param roleid
         * @param resourceidList
         * @return
         */
        int saveRoleResourcePlatform(@Param("roleid") String roleid, @Param("resourceidList") List<String> resourceidList);

        List<CpSsorolePlatformDTO> selectAll();

        CpSsorolePlatform selectByRoleid(@Param("roleid") String roleid);
    }

}
